package com.cloud.mall.log.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitmqConfig {

    @Bean
    public Queue logQueue() {
        Queue queue = new Queue("mall-log-error");
        return queue;
    }

    @Bean
    DirectExchange logDirectExchange() {
        return new DirectExchange("logDirectExchange",true,false);
    }

    @Bean
    Binding bindingDirect() {
        return BindingBuilder.bind(logQueue()).to(logDirectExchange()).with("logDirectRouting");
    }

}
